var table ,form ,laypage ,layer ,element ,laydate ,upload//时间组件
$(function(){
    layui.use(['table','form','laypage','layer', 'element', 'laydate','upload','laytpl'], function(){
    	table = layui.table;
        form=layui.form;
        laypage = layui.laypage ;//分页
        layer = layui.layer ;//弹层
        element = layui.element; //元素操作
        laydate = layui.laydate; //时间组件 
        upload = layui.upload;
        laytpl = layui.laytpl;
        TimeTools();
        //selectStation();//变电站
        statisticsAge("dengji");///*设备告警占比*/
        statisticsGjzt("gjzt");//告警状态占比
        statisticsCLTJ()//处理统计
        statisticspolice()//设备故障申报
              
        
    });
});
///*最近七日告警等级比例*/
function statisticsAge(model){
	var myChart = echarts.init(document.getElementById(model));
	// 指定图表的配置项和数据
	var option = {
			title: {
		        text: '',
		        padding:[20,0,0,10],
                textAlign:'left',
	            textStyle:{
	                color:'#fff',
	        　　　　                fontSize:14,
	        　　　　     
	            }
		    },
		    legend: {
		        orient: 'vertical',
		        left: 'right',
		    	textStyle:{
 	                color:'#1bdcef',
 	        　　　　                fontSize:10,
 	            },
		        top: '5%'
		    },
		    tooltip : {  
	            trigger: 'item',  
	            formatter: "{c}%"  
	        },
		    series: [
		    	{
		            name: '',
		            type: 'pie',
		            selectedMode: 'single',
		            radius: [0, '15%'],
		            center: ['30%', '50%'],
		            label: {
		                position: 'inner',
		                normal: {
				        	color:"#ee6666"
			            },
		            },
		            tooltip : {  
		            	show: false,
			        },
		            labelLine: {
		                show: false,
		               
		            },
		            data: [
		                {value:18, name: ''},
		            ]
		        },
		        {
		            name: '',
		            type: 'pie',
		            radius: ['23%', '70%'],
		            center: ['30%', '50%'],
		            roseType: 'area',
		            itemStyle: {
		                borderRadius: 5
		            },
		            label: {
			            normal: {
			            	textStyle:{
				        		color:'#00ffff'
				        	},
				        	show: true,
			        		formatter: "{c}%"
			            },
			        },
		            data: [
		                {value: 10, name: '变压器'},
		                {value: 19, name: '电流互感器'},
		                {value: 18, name: '隔离开关'},
		                {value: 10, name: '断路器'},
		                {value: 9, name: '接地开关'},
		                {value: 10, name: '电容器'},
		                {value: 12, name: '避雷器'},
		                {value: 11, name: '开关柜'},
		            ]
		        }
		    ]
    };
	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(option,true);
    setInterval(function(){
    	myChart.clear();
    	myChart.setOption(option,true);
    },5000);
}
//告警状态占比
function statisticsGjzt(model){
	var myChart2 = echarts.init(document.getElementById(model));
	var option = {		    
			title: {
		        text: '',
		        padding:[20,0,0,10],
                textAlign:'left',
	            textStyle:{
	                color:'#fff',
	        　　　　                fontSize:14,
	        　　　　     
	            }
		    },
		    legend: {
		        orient: 'vertical',
		        left: 'right',
		    	textStyle:{
 	                color:'#1bdcef',
 	        　　　　                fontSize:10,
 	            },
		        top: '5%',
		        data: ['告知', '异常', '越线', '变位', '事故', '已恢复', '处理中', '已查核', '未查核']
		    },
		    tooltip: {
		        trigger: 'item',
		        formatter: '{b}:{c}%'
		    },
		    series: [
		        {
		            name: '',
		            type: 'pie',
		            selectedMode: 'single',
		            radius: [0, '30%'],
		            center: ['35%', '50%'],
		            label: {
		                position: 'inner',
		                fontSize: 12,
		                textStyle:{
			        		color:'#fff'
			        	},
		                formatter: '{c}%',
		               
		            },
		            labelLine: {
		                show: false,
		               
		            },
		            data: [
		                {value: 18, name: '告知'},
		                {value: 35, name: '异常'},
		                {value: 19, name: '越线'}
		            ]
		        },
		        {
		            name: '',
		            type: 'pie',
		            radius: ['45%', '60%'],
		            center: ['35%', '50%'],
		            labelLine: {
		                length: 30,
		            },
		            label: {
		            	normal: {
			            	textStyle:{
				        		color:'#00ffff'
				        	},
				        	show: true,
			        		formatter: "{c}%"
			            },
		            },
		            data: [
		                {value: 8, name: '越线'},
		                {value: 15, name: '越线'},
		                {value: 10, name: '变位'},
		                {value: 15, name: '事故'},
		                {value: 14, name: '已恢复'},
		                {value: 17, name: '处理中'},
		                {value: 15, name: '已查核'},
		                {value: 10, name: '未查核'}
		            ]
		        }
		    ]
    };
	myChart2.setOption(option,true);
    setInterval(function(){
    	myChart2.clear();
    	myChart2.setOption(option,true);
    },5500);
}
//处理统计
function statisticsCLTJ(){
	var myChart3 = echarts.init(document.getElementById('cltj'));
    var option = {
    		 title: {
 		        text: '',
 		        padding:[20,0,0,10],
                textAlign:'left',
 	            textStyle:{
 	                color:'#1bdcef',
 	        　　　　                fontSize:12,
 	            }
 		    },
    	    tooltip: {
    	        trigger: 'axis',
    	        axisPointer: {
    	            type: 'cross',
    	            crossStyle: {
    	                color: '#999'
    	            }
    	        }
    	    },
    	    grid: {
    			left: 50,
    			bottom:30
    		},
    	    legend: {
    	    	 padding:[10,0,0,0],
 		         textStyle:{
 	                color:'#1bdcef',
 	        　　　　                fontSize:10,
 	            },
    	        data: ['告警总数', '核查总数', '处理总数']
    	    },
    	    xAxis: {
    	            type: 'category',
					boundaryGap: false,
					boundaryGap:true,
			        splitLine:{ //网格线
			          show:false,
			        },
			        axisLabel: { //x坐标文字样式
			        	color: "rgba(0,168,233,1)"
			        },
			        axisLine: {//X轴样式
						show:true,
						lineStyle: {
							color: 'rgba(0,168,233,1)'
						}
					},
    	            data: ['变电站1', '变电站2', '变电站3', '变电站4', '变电站5', '变电站6'],
    	     },
    	    yAxis:{
				type: 'value',
				axisLine: {
					show:true,
					lineStyle: {
						color: 'rgba(0,168,233,1)'
					}
				},
				splitLine: {
					lineStyle: {
						color: 'rgba(0,168,233,1)'
					}
				},
				axisLabel: {
					color: "rgba(0,168,233,1)"
				},
    	    },
    	    series: [
    	        {
    	            name: '告警总数',
    	            type: 'bar',
    	            data: [10, 12, 9, 11, 11, 15]
    	        },
    	        {
    	            name: '核查总数',
    	            type: 'bar',
    	            data: [10, 11, 9, 6, 8, 13]
    	        },
    	        ,
    	        {
    	            name: '处理总数',
    	            type: 'bar',
    	            data: [10, 10, 9, 8, 4, 12]
    	        },
    	    ]
    	};
	myChart3.setOption(option,true);
    setInterval(function(){
    	myChart3.clear();
    	myChart3.setOption(option,true);
    },5000);
}
//设备故障申报
function statisticspolice(){
	var myChart4 = echarts.init(document.getElementById("call_police"));
	var option4 = {
			title: {
		        text: '短路故障',
		        x:'center',
                y:'80%',
                textAlign:'left',
	            textStyle:{
	                color:'#1bdcef',
	        　　　　                fontSize:14
	            }
		    },
		    grid: {},
			color: ['#209cfe'],	
		    series: [{
		        type: 'gauge',
		        startAngle: 90,
		        endAngle: -270,
		        pointer: {
		            show: false
		        },
		        progress: {
		            show: true,
		            overlap: false,
		            roundCap: true,
		            clip: false,
		            itemStyle: {
		                backgroundColor: '#1392f1'
		            }
		        },
		        axisLine: {
		            lineStyle: {
		                width: 10,
		               // color:'#00bae9'		               
		            }
		        },
		        splitLine: {
		            show: false,
		            distance: 0,
		            length: 10
		        },
		        axisTick: {
		            show: false
		        },
		        axisLabel: {
		            show: false,
		            distance: 50
		        },
		        data: [{
		            value: 39.79,
		           // name: 'Perfect',		           
		        }
		        ],
		        title: {
		            fontSize: 14
		        },
		        detail: {
		            width: 50,
		            height: 14,
		            fontSize: 14,
		            color: '#fff',
		            /*borderColor: 'auto',
		            borderRadius: 20,
		            borderWidth: 1,*/
		            offsetCenter: ['0%', '0%'],
		            formatter: '{value}%'
		        }
		    }]
		};
	myChart4.setOption(option4,true);
    setInterval(function(){
    	myChart4.clear();
    	myChart4.setOption(option4,true);
    },5200);
	//等级2

	var myChart5 = echarts.init(document.getElementById("call_police2"));
	var option5 = {
			title: {
		        text: '断相故障',
		        x:'center',
                y:'80%',
                textAlign:'left',
	            textStyle:{
	                color:'#1bdcef',
	        　　　　                fontSize:14
	            }
		    },
		    grid: {},
			color: ['#209cfe'],	
		    series: [{
		        type: 'gauge',
		        startAngle: 90,
		        endAngle: -270,
		        pointer: {
		            show: false
		        },
		        progress: {
		            show: true,
		            overlap: false,
		            roundCap: true,
		            clip: false,
		            itemStyle: {
		                backgroundColor: '#1392f1'
		            }
		        },
		        axisLine: {
		            lineStyle: {
		                width: 10
		            }
		        },
		        splitLine: {
		            show: false,
		            distance: 0,
		            length: 10
		        },
		        axisTick: {
		            show: false
		        },
		        axisLabel: {
		            show: false,
		            distance: 50
		        },
		        data: [{
		            value: 29.2,
		           // name: 'Perfect',
		        }
		        ],
		        title: {
		            fontSize: 14
		        },
		        detail: {
		            width: 50,
		            height: 14,
		            fontSize: 14,
		            color: '#fff',
		            /*borderColor: 'auto',
		            borderRadius: 20,
		            borderWidth: 1,*/
		            offsetCenter: ['0%', '0%'],
		            formatter: '{value}%'
		        }
		    }]
		};
	myChart5.setOption(option5,true);
    setInterval(function(){
    	myChart5.clear();
    	myChart5.setOption(option5,true);
    },5500);
	//等级3

	var myChart6 = echarts.init(document.getElementById("call_police3"));
	var option6 = {
			title: {
		        text: '复杂故障',
		        x:'center',
                y:'80%',
                textAlign:'left',
	            textStyle:{
	                color:'#1bdcef',
	        　　　　                fontSize:14
	            }
		    },
		    grid: {},
			color: ['#209cfe'],	
		    series: [{
		        type: 'gauge',
		        startAngle: 90,
		        endAngle: -270,
		        pointer: {
		            show: false
		        },
		        progress: {
		            show: true,
		            overlap: false,
		            roundCap: true,
		            clip: false,
		            itemStyle: {
		                backgroundColor: '#1392f1'
		            }
		        },
		        axisLine: {
		            lineStyle: {
		                width: 10
		            }
		        },
		        splitLine: {
		            show: false,
		            distance: 0,
		            length: 10
		        },
		        axisTick: {
		            show: false
		        },
		        axisLabel: {
		            show: false,
		            distance: 50
		        },
		        data: [{
		            value: 9.6,
		           // name: 'Perfect',
		        }
		        ],
		        title: {
		            fontSize: 14
		        },
		        detail: {
		            width: 50,
		            height: 14,
		            fontSize: 14,
		            color: '#fff',
		            /*borderColor: 'auto',
		            borderRadius: 20,
		            borderWidth: 1,*/
		            offsetCenter: ['0%', '0%'],
		            formatter: '{value}%'
		        }
		    }]
		};
	myChart6.setOption(option6,true);
    setInterval(function(){
    	myChart6.clear();
    	myChart6.setOption(option6,true);
    },5800);
    
    
	var myChart7 = echarts.init(document.getElementById("call_police4"));
	var option7 = {
			title: {
		        text: '自然灾害引起故障',
		        x:'center',
                y:'80%',
                textAlign:'left',
	            textStyle:{
	                color:'#1bdcef',
	        　　　　                fontSize:14
	            }
		    },
		    grid: {},
			color: ['#209cfe'],	
		    series: [{
		        type: 'gauge',
		        startAngle: 90,
		        endAngle: -270,
		        pointer: {
		            show: false
		        },
		        progress: {
		            show: true,
		            overlap: false,
		            roundCap: true,
		            clip: false,
		            itemStyle: {
		                backgroundColor: '#1392f1'
		            }
		        },
		        axisLine: {
		            lineStyle: {
		                width: 10
		            }
		        },
		        splitLine: {
		            show: false,
		            distance: 0,
		            length: 10
		        },
		        axisTick: {
		            show: false
		        },
		        axisLabel: {
		            show: false,
		            distance: 50
		        },
		        data: [{
		            value: 11.6,
		           // name: 'Perfect',
		        }
		        ],
		        title: {
		            fontSize: 14
		        },
		        detail: {
		            width: 50,
		            height: 14,
		            fontSize: 14,
		            color: '#fff',
		            /*borderColor: 'auto',
		            borderRadius: 20,
		            borderWidth: 1,*/
		            offsetCenter: ['0%', '0%'],
		            formatter: '{value}%'
		        }
		    }]
		};
	myChart7.setOption(option7,true);
    setInterval(function(){
    	myChart7.clear();
    	myChart7.setOption(option7,true);
    },5800);


}